#include <iostream>
#define BOX 20         //棋盘大小
int g_checkboard[BOX][BOX] = {0};               //棋盘对局的数据
int g_currentGamer;         //1表示黑子，2表示白子
int g_cursorX,g_cursorY;        //当前光标的位置
int g_count = 0;            //游戏回合数
using namespace std;
//判断输赢
int Check();
//判断是否平局
int NoWin();
//禁手判断
bool BanHand(int N);
 
int main()
{
    int winner = 0;     //赢家
     
    while(cin>>g_currentGamer>>g_cursorX>>g_cursorY)
    {
        g_checkboard[g_cursorX][g_cursorY] = g_currentGamer;
        winner=Check();
                //1.判断平局
                if(NoWin() == 0)
                {
                    cout<<"not end";
                    break;
                }
                //2.判断输赢
                else if (winner == 1)
                {
                    cout<<"black win";
                    break;
                }
				//3.判断禁手
                else if(BanHand(3)|BanHand(4))
                {
                    cout<<"white win";
                    break;
                }
                else if(winner==2)
                {
                    cout<<"white win";
                    break;
                }
                
	}
    return 0;
}
//判断平局
int NoWin(){
    int Zero = 0;
    for(int i = 0; i < BOX; i++)
        for(int j = 0; j < BOX; j++)
            if(g_checkboard[i][j] == 0)
                Zero++;
    return Zero;
}
 
//判断输赢
int Check()
{
    int Horizontal = 1;             //水平方向
    int Vertical = 1;               //垂直方向
    int PositiveDirection = 1;      //正斜向
    int NegtiveDirection = 1;       //反斜向
 
    //向下
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorY + i < BOX && g_checkboard[g_cursorX][g_cursorY + i] == g_currentGamer)
            Horizontal++;
        else
            break;
    }
    //向上
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorY - i < BOX && g_checkboard[g_cursorX][g_cursorY - i] == g_currentGamer)
            Horizontal++;
        else
            break;
    }
    if (Horizontal >= 5)
        return g_currentGamer;
 
    //向左
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorX + i < BOX && g_checkboard[g_cursorX + i][g_cursorY] == g_currentGamer)
            Vertical++;
        else
            break;
    }
    //向右
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorX - i < BOX && g_checkboard[g_cursorX - i][g_cursorY] == g_currentGamer)
            Vertical++;
        else
            break;
    }
    if (Vertical >= 5)
        return g_currentGamer;
 
    //坐上
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorX - i < BOX && g_cursorY - i < BOX && g_checkboard[g_cursorX - i][g_cursorY - i] == g_currentGamer)
            PositiveDirection++;
        else
            break;
    }
    //右下
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorX + i < BOX && g_cursorY + i < BOX && g_checkboard[g_cursorX + i][g_cursorY + i] == g_currentGamer)
            PositiveDirection++;
        else
            break;
    }
    if (PositiveDirection >= 5)
        return g_currentGamer;
 
    //左下
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorX - i < BOX && g_cursorY + i < BOX && g_checkboard[g_cursorX - i][g_cursorY + i] == g_currentGamer)
            NegtiveDirection++;
        else
            break;
    }
    //右上
    for (int i = 1; i < 5; i++)
    {
        if (g_cursorX + i < BOX && g_cursorY - i < BOX && g_checkboard[g_cursorX + i][g_cursorY - i] == g_currentGamer)
            NegtiveDirection++;
        else
            break;
    }
    if (NegtiveDirection >= 5)
        return g_currentGamer;
 
    return 0;
}
//禁手判断
 
bool BanHand(int N){
    int live[8]={0};
    int threeNum;
    //活子判断
    for(int i = 1;i <= N;i++)
    {//数出每条线上有几个黑子
        if(g_cursorY + i < BOX && g_checkboard[g_cursorX][g_cursorY + i] == 1 && g_checkboard[g_cursorX][g_cursorY + i + 1] != 2 && g_checkboard[g_cursorX][g_cursorY - 1] != 2)//下
            live[0]++;
        if(g_cursorY - i > 0 && g_checkboard[g_cursorX][g_cursorY - i] == 1 && g_checkboard[g_cursorX][g_cursorY - i - 1] != 2 && g_checkboard[g_cursorX][g_cursorY + 1] != 2)//上
            live[1]++;
        if(g_cursorX + i < BOX && g_checkboard[g_cursorX + i][g_cursorY] == 1 && g_checkboard[g_cursorX + i + 1][g_cursorY] != 2 && g_checkboard[g_cursorX - 1][g_cursorY] != 2)//右
            live[2]++;
        if(g_cursorX - i > 0 && g_checkboard[g_cursorX - i][g_cursorY] == 1 && g_checkboard[g_cursorX - i - 1][g_cursorY] != 2 && g_checkboard[g_cursorX + 1][g_cursorY] != 2)//左
            live[3]++;
        if(g_cursorX + i < BOX && g_cursorY + i < BOX && g_checkboard[g_cursorX + i][g_cursorY + i] == 1 && g_checkboard[g_cursorX + i + 1][g_cursorY + i + 1] != 2 && g_checkboard[g_cursorX - 1][g_cursorY -1] != 2)//右下
            live[4]++;
        if(g_cursorX - i > 0 && g_cursorY + i < BOX && g_checkboard[g_cursorX - i][g_cursorY + i] == 1 && g_checkboard[g_cursorX - i - 1][g_cursorY + i +1] != 2 && g_checkboard[g_cursorX - 1][g_cursorY + 1] != 2)//左下
            live[5]++;
        if(g_cursorX + i < BOX && g_cursorY - i > 0 && g_checkboard[g_cursorX + i][g_cursorY - i] == 1 && g_checkboard[g_cursorX + i + 1][g_cursorY - i - 1] != 2 && g_checkboard[g_cursorX + 1][g_cursorY - 1] != 2)//右上
            live[6]++;
        if(g_cursorX - i > 0 && g_cursorY - i > 0 && g_checkboard[g_cursorX - i][g_cursorY - i] == 1 && g_checkboard[g_cursorX - i - 1][g_cursorY - i - 1] != 2 && g_checkboard[g_cursorX + 1][g_cursorY + 1] != 2)//左上
            live[7]++;
    }
    threeNum = 0;
    for(int i = 0;i < 8;i++)
        if(live[i]>=N-1)
            threeNum++;
    if(threeNum >=2)
        return true;
    else
        return false;
     
}